package magicboard.model
{
	import flash.geom.Point;
	
	import mx.utils.StringUtil;
	
	
	/**
	 * Model with figures
	 */
	public class Model
	{
		
		// --------------------------------------------------------------------------------------------
		public function Model()
		{
		}

		// --------------------------------------------------------------------------------------------
		public function get objects():Array { return _objects; }
		
		// --------------------------------------------------------------------------------------------
		public function addObject(obj:InkStroke):void{
		  _objects.push(obj);
		}
		
		// --------------------------------------------------------------------------------------------
		public function clear():void{
		  
		  while(_objects.length > 0)
		  	_objects.pop();
		}
		
		// --------------------------------------------------------------------------------------------
		public function loadFromString(line:String):void{
			if(line.indexOf(":") > 0){
				var obj:InkStroke = new InkStroke();
				if(obj.loadFromString(line))
					addObject(obj);
			}
		}
		
		// --------------------------------------------------------------------------------------------
		public function removeLastObj():void{
		  
		  if(_objects.length > 0)
		  	_objects.pop();
		}
		
		// --------------------------------------------------------------------------------------------
		// Private members
		private var _objects:Array = new Array();;
	}
}